//
//  ContentHeadView.m
//  ProjectsOne
//
//  Created by iOS开发 on 2018/7/10.
//  Copyright © 2018年 iOS开发. All rights reserved.
//

#import "ContentHeadView.h"

@interface ContentHeadView ()
@property (nonatomic, strong) UIImageView *headImageView;
@property (nonatomic, strong) UIImageView *bgImageView;
@property (nonatomic, strong) UIButton *memberButton;
@property (nonatomic, strong) UILabel *nameLabel;


@property (nonatomic, strong) UILabel *leftLabel;
@property (nonatomic, strong) UILabel *leftLittleLabel;
@property (nonatomic, strong) UILabel *rightLabel;
@property (nonatomic, strong) UILabel *rightLittleLabel;
@end

@implementation ContentHeadView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    _bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"service_details_top_bg"]];
    [self addSubview:_bgImageView];
    
    [_bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.bottom.mas_equalTo(self).with.offset(-4);
    }];
    
    _headImageView = [[UIImageView alloc] init];
//    _headImageView.image = [UIImage imageNamed:@"service_details_top_photo_bg"];
    _headImageView.backgroundColor = [UIColor redColor];
    _headImageView.layer.cornerRadius = 75 / 2;
    [self addSubview:_headImageView];
    
    [_headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self).with.offset(30);
        make.top.mas_equalTo(self).with.offset(88.5);
        make.width.height.mas_equalTo(75);
    }];
    
    _memberButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_memberButton setTitle:@"金牌会员" forState:UIControlStateNormal];
    _memberButton.titleLabel.font = [UIFont systemFontOfSize:13];
    [_memberButton setTitleColor:[UIColor colorWithHexString:@"ffa631"] forState:UIControlStateNormal];
    _memberButton.layer.borderColor = [UIColor colorWithHexString:@"ffa631"].CGColor;
    _memberButton.layer.borderWidth = .5f;
    _memberButton.layer.cornerRadius = 7.5;
    [self addSubview:_memberButton];
    
    [_memberButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(60);
        make.height.mas_equalTo(15);
        make.right.mas_equalTo(self).with.offset(-25);
        make.top.mas_equalTo(self).with.offset(55 + 90);
    }];

    _nameLabel = [[UILabel alloc] init];
    _nameLabel.font = [UIFont systemFontOfSize:18];
    _nameLabel.textColor = [UIColor colorWithHexString:@"#333333"];
    _nameLabel.text = @"苏有朋";
    [self addSubview:_nameLabel];
    
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.memberButton.mas_centerY);
        make.left.mas_equalTo(self).with.offset(123);
        make.right.mas_equalTo(self.memberButton.mas_left).with.offset(-10);
    }];
    
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = [UIColor colorWithHexString:@"#dddddd"];
    [self addSubview:line];
    
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(.5f);
        make.height.mas_equalTo(35);
        make.bottom.mas_equalTo(self).with.offset(-19);
        make.centerX.mas_equalTo(self);
    }];
    
    _leftLabel = [[UILabel alloc] init];
    _leftLabel.font = [UIFont systemFontOfSize:16];
    _leftLabel.textAlignment = NSTextAlignmentCenter;
    _leftLabel.textColor = [UIColor colorWithHexString:@"#333333"];
    _leftLabel.text = @"左侧大标题左侧大标题左侧大标题左侧大标题左侧大标题左侧大标题";
    [self addSubview:_leftLabel];
    
    [_leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.baseline.mas_equalTo(line.mas_bottom);
        make.right.mas_equalTo(line).with.offset(-10);
        make.left.mas_equalTo(self).with.offset(20);
    }];
    
    _rightLabel = [[UILabel alloc] init];
    _rightLabel.font = [UIFont systemFontOfSize:16];
    _rightLabel.textColor = [UIColor colorWithHexString:@"#333333"];
    _rightLabel.text = @"右侧大标题";
    _rightLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:_rightLabel];
    
    [_rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.baseline.mas_equalTo(line.mas_bottom);
        make.left.mas_equalTo(line).with.offset(10);
        make.right.mas_equalTo(self).with.offset(-20);
    }];
    
    _rightLittleLabel = [[UILabel alloc] init];
    _rightLittleLabel.font = [UIFont systemFontOfSize:14];
    _rightLittleLabel.textColor = [UIColor colorWithHexString:@"#999999"];
    _rightLittleLabel.text = @"右侧小标题";
    _rightLittleLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:_rightLittleLabel];
    
    [_rightLittleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.baseline.mas_equalTo(self.rightLabel.mas_top).with.offset(-10);
        make.left.mas_equalTo(line).with.offset(10);
        make.right.mas_equalTo(self).with.offset(-20);
    }];
    
    _leftLittleLabel = [[UILabel alloc] init];
    _leftLittleLabel.font = [UIFont systemFontOfSize:14];
    _leftLittleLabel.textColor = [UIColor colorWithHexString:@"#999999"];
    _leftLittleLabel.text = @"左侧小标题左侧小标题左侧小标题左侧小标题";
    _leftLittleLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:_leftLittleLabel];
    
    [_leftLittleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.baseline.mas_equalTo(self.rightLittleLabel.mas_baseline);
        make.right.mas_equalTo(line).with.offset(-10);
        make.left.mas_equalTo(self).with.offset(20);
    }];
    
    
}

@end
